<!--
 * @Author: 张帆 zhangfan@jxtech.net
 * @Date: 2024-12-16 10:05:37
 * @LastEditors: 张帆 zhangfan@jxtech.net
 * @LastEditTime: 2024-12-16 11:06:59
 * @FilePath: /vite-ts-vue3/src/views/xiaozhi/1.props传递/user.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
    <div>
       <p @click="handleUserName">姓名：{{ name }}</p>
       <p>职业：{{ job }}</p>
       <p @click="handleUserAge">年龄：{{ age }}</p>
    </div>
 </template>
    
<script setup>
import { ref } from 'vue'
 
const props = defineProps({
   name: String,
   job: String,
   age: Number,
})

const emit = defineEmits(['updateUserName', 'updateUserAge'])
 
const count = ref(0)

const handleUserName = () => {
   emit('updateUserName', props.name)
}
const handleUserAge = () => {
 emit('updateUserAge', props.age)
}
</script>